package com.bwie.controller;

import com.bwie.service.TbUserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginInfoVo;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.RegInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/18 15:07
 * @Description:
 **/

@RestController
@RequestMapping("/user/index")
@Slf4j
public class IndexController {

    @Autowired
    TbUserService tbUserService;

    /**
     * 发送手机号验证码
     * @param mobile
     * @return
     */
    @PostMapping("/sendCode/{mobile}")
    public R sendCode(@PathVariable("mobile") String mobile){
        return tbUserService.sendCode(mobile);
    }

    /**
     * 用户注册
     * @param regInfoVo
     * @return
     */
    @PostMapping("/userReg")
    public R userReg(@RequestBody RegInfoVo regInfoVo){
        return tbUserService.userReg(regInfoVo);


    }

    /**
     * 登录接口
     * @param loginInfoVo
     * @return
     */
    @PostMapping("/login")
    public R login(@RequestBody LoginInfoVo loginInfoVo){
        return tbUserService.login(loginInfoVo);
    }

    /**
     * 权限树形菜单
     * @param loginInfoVo
     * @return
     */
    @PostMapping("/getTreeMenu")
    public R getTreeMenu(){
       return tbUserService.getTreeMenu();
    }

    /**
     * 商户分页列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getUserList")
    public R getShopperList(@RequestBody PageInfoVo pageInfoVo){
        return tbUserService.getShopperList(pageInfoVo);
    }


}
